package cn.tedu.jws.modules.owner.controller;

import cn.tedu.jws.modules.owner.pojo.dto.OwnerAddNewDTO;
import cn.tedu.jws.modules.owner.service.OwnerService;
import cn.tedu.jws.modules.owner.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Slf4j
@RequestMapping("/jws/admin/owner")
@Api(tags = "01.业主管理")
public class OwnerController {

    @Autowired
    private OwnerService ownerService;

    @PostMapping("/add-new")
    @ApiOperation("添加业主")
    @ApiOperationSupport(order = 100)
    public JsonResult<Void> addNew(@Valid OwnerAddNewDTO ownerAddNewDTO){
        log.debug("开始处理【添加业主】的请求，参数：{}", ownerAddNewDTO);
        ownerService.addNew(ownerAddNewDTO);
        return JsonResult.ok();
    }
}
